package com.neusoft.hifly.core.pojo;

/**
 * Title: 核心类库
 * <p>
 * Description: API模块回执类型
 * <p>
 * Copyright: 2019
 * <p>
 * Company: 东软汉枫
 *
 * @author lh_neu
 * @version 1.0.0
 */
public enum ApiCode {

	SUCCESS(0, "成功"),

	ERROR(-001, "系统异常"),

	Failed(-100000, "操作失败"),

	Exception(-100001, "操作失败"),

	DatabaseError(-100002, "操作失败"),

	BAD_REQUEST(-002, "错误的请求参数"),

	NOT_FOUND(-003, "找不到请求路径！"),

	CONNECTION_ERROR(-004, "网络连接请求失败！"),

	METHOD_NOT_ALLOWED(-005, "不合法的请求方式"),

	REPEAT_OPERATION(-006, "请勿重复请求！"),

	DataDuplication(2, "数据出现重复"),

	FileIsBig(3, "文件超出限制"),

	DataIsNull(4, "数据为空"),

	TIMEOUT(408, "请求超时"),

	AUTH(401, "请求要求身份验证"),

	ILLEGAL_TOKEN(50008, "非法令牌"),

	OTHER_CLIENTS_LOGGED_IN(50012, "其他客户端登录"),

	TOKEN_EXPIRED(50014, "令牌过期");

	// 编码
	private int code;

	// 信息
	private String msg;

	ApiCode(final int code, final String msg) {
		this.code = code;
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
	}

	public int getCode() {
		return code;
	}

	public void setCode(final int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(final String msg) {
		this.msg = msg;
	}
}
